﻿'Params
'event (Required) : The numeric last.fm event id
'page (Optional) : The page number to fetch. Defaults to first page.
'limit (Optional) : The number of results to fetch per page. Defaults to 50.
'api_key (Required) : A Last.fm API key.
'Auth
'This service does not require authentication. 

Public Structure EventGetShoutsResponse
    Dim shouts() As Shout

End Structure

Public Class EventGetShouts
	Inherits BaseRequest
	Dim event_ As String = ""
	Dim page As String = ""
	Dim limit As String = ""

	Public xmlresponse As XDocument = Nothing

	Public Sub New(event_ As String, limit As String, page As String)
		Me.event_ = event_
		Me.page = page
		Me.limit = limit
	End Sub

	Public Sub sendRequest()
        InitializeMembers("event.getShouts")

        AddMember("event", event_, True)
        AddMember("page", page, False)
        AddMember("limit", limit, False)
        AddMember("api_key", My.Settings.api_key, False)

        xmlresponse = sendPOSTResponse()
	End Sub

    Public Function getResponse() As EventGetShoutsResponse
        Dim response As EventGetShoutsResponse = Nothing
        Dim count As Integer
        Try
            count = xmlresponse.<lfm>.<shouts>.<shout>.Count()
        Catch ex As Exception
            Return response
        End Try
        If (count > 0) Then
            ReDim response.shouts(count - 1)
            For i As Integer = 0 To count - 1
                response.shouts(i) = New Shout(xmlresponse.<lfm>.<shouts>.<shout>(i))
            Next
        End If
        Return response
    End Function
End Class
